Skip to content

fix: force UTF-8 console so Oracle server starts on Windows cp1252#19

Merged
drknowhow merged 1 commit into
mainfrom
fix/oracle-windows-utf8-banner
Jun 14, 2026
Merged

fix: force UTF-8 console so Oracle server starts on Windows cp1252#19
drknowhow merged 1 commit into
mainfrom
fix/oracle-windows-utf8-banner

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

Summary

Fixes a Windows-only startup crash. The Oracle server's banner prints a character that raises UnicodeEncodeError on consoles/pipes using the cp1252 code page (observed on Python 3.14), so python oracle/oracle_server.py never finished booting — it required a PYTHONIOENCODING=utf-8 workaround.

Fix

_force_utf8_console() in oracle/oracle_server.py, called first in run_oracle(), reconfigures stdout/stderr to UTF-8 with errors="replace". One place fixes the two startup banners and the logging StreamHandler, and won't crash if a stream can't be reconfigured.

Testing

Started the server without the PYTHONIOENCODING=utf-8 workaround that was previously required — it now boots cleanly and GET /api/health returns ok. Banner renders correctly:

Oracle Memory Agent  →  http://localhost:3331  (model: gpt-oss:120b-cloud)
Oracle Discovery MCP  →  http://127.0.0.1:3332/mcp  (auth: bearer)

🤖 Generated with Claude Code

run_oracle printed a '→' in its startup banner, which crashed with
UnicodeEncodeError on Windows consoles/pipes using the cp1252 code page
(observed on Python 3.14), so the server never finished booting. Added
_force_utf8_console(), called first in run_oracle, to reconfigure
stdout/stderr to UTF-8 (errors="replace") — covering both startup banners
and the logging StreamHandler. Verified the server now boots without the
PYTHONIOENCODING=utf-8 workaround.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 14, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Windows-only Oracle server startup crash caused by writing a character to stdout/stderr when the active console/pipes use the cp1252 code page (triggering UnicodeEncodeError).

Changes:

  • Add _force_utf8_console() to reconfigure sys.stdout/sys.stderr to UTF-8 with errors="replace".
  • Call _force_utf8_console() at the start of run_oracle() so startup banners and early log output won’t crash.

Comment thread oracle/oracle_server.py
Comment on lines +828 to +835
def _force_utf8_console() -> None:
"""Make stdout/stderr UTF-8 so banner/log output can't crash on legacy
Windows code pages (cp1252 raises UnicodeEncodeError on chars like '→')."""
for stream in (sys.stdout, sys.stderr):
try:
stream.reconfigure(encoding="utf-8", errors="replace")
except (AttributeError, ValueError, OSError):
pass
Comment thread oracle/oracle_server.py

def run_oracle(port: int = None, open_browser: bool = None):
"""Main entry point for Oracle server."""
_force_utf8_console()
@drknowhow drknowhow merged commit 3ab4508 into main Jun 14, 2026
12 checks passed
@drknowhow drknowhow deleted the fix/oracle-windows-utf8-banner branch June 14, 2026 11:57
drknowhow added a commit that referenced this pull request Jun 14, 2026
… <1s (v2.38.1) (#20)

build_runtime() did ~20s of synchronous ML init (chromadb VectorStore +
EmbeddingIndex construction + Ollama probes) before the MCP handshake, exceeding
Claude Code's default MCP startup timeout and marking c3 "× Failed to connect".

Both stores now initialize their chromadb/Ollama backends lazily on first use via
a lock-guarded, idempotent _ensure_ready(); work methods self-ensure, status views
(ready/vector_enabled/get_stats) stay non-blocking. The MCP lifespan warms them in
the background (and no longer gates the build on a synchronous .ready check, which
would otherwise re-block the handshake). build_runtime drops from ~20s to ~0.26s;
no MCP_TIMEOUT override needed.

Bumps version to 2.38.1 and documents this plus the Windows cp1252 UTF-8 banner
fix (#19) in the changelog. 427 tests pass.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants